package com.demo12;

import java.util.ArrayList;

public class List2Demo {
    public static void main(String[] args) {
        ArrayList<Students> arrayList = new ArrayList<>();

        Students s1 = new Students("林青霞", 20);
        Students s2 = new Students("王祖贤", 21);
        Students s3 = new Students("张曼玉", 22);

        arrayList.add(s1);
        arrayList.add(s2);
        arrayList.add(s3);

        for (Students s:arrayList){
            System.out.println(s.getName()+"---"+s.getAge());
        }
    }
}
